package com.xuecheng.content.api;

import com.xuecheng.content.model.dto.CoursePreviewDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author itcast
 */
@RestController
@Api(value = "课程审核管理接口", tags = "课程审核管理接口")
@RequestMapping("/course-audit")
public class CourseAuditController {

    @GetMapping("/{id}")
    @ApiOperation("查询审核的课程发布信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "审核记录id", dataTypeClass = Long.class)
    })
    public ModelAndView queryCoursePublishPre(@PathVariable("id") Long id) {
        ModelAndView modelAndView = new ModelAndView();

        //TODO 查询课程的信息作为模型数据，替换掉下面new的数据模型
        CoursePreviewDto coursePreviewInfo = new CoursePreviewDto();

        //指定模型
        modelAndView.addObject("model", coursePreviewInfo);
        //指定模板,根据视图名称加.ftl找到模板
        modelAndView.setViewName("course_template");
        return modelAndView;
    }
}
